#include "StateMenu.h"
#include "CGame.h"
#include "stdio.h"
#include "CDXManager.h"
#include "StateGame.h"
StateMenu::StateMenu():m_iCount(0),CState(){}

void StateMenu::Init()
{
	m_iCount=50;
	ErrorTrace(L"State Menu!:Init");
	m_pBackGr=CDXManager::GetInstance()->LoadSurface(MENU);
}

void StateMenu::Update()
{
	ErrorTrace(L"State Menu!:Update");
	if (m_iCount<1)
	{
		CStateManagement::GetInstance()->SwitchState(new StateGame());
	}
	m_iCount--;
}
void StateMenu::Render()
{
	ErrorTrace(L"State Menu!:Render");
	CDXManager::GetInstance()->BeginRender();
	CDXManager::GetInstance()->RenderSurface();
	CDXManager::GetInstance()->EndRender();
}
void StateMenu::Exit()
{	
	if (m_pBackGr)
	{
		m_pBackGr->Release();
		m_pBackGr=NULL;
	}
	ErrorTrace(L"State Menu:Exit");
}
